package com.project.service;

import com.project.entity.Order;
import com.project.mapper.OrderMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderService {
    @Autowired
    private OrderMapper orderMapper;

    public List<Order> findPage(Integer pageIndex,Integer pageItemCount,String type){

        Integer first = (pageIndex-1)*pageItemCount;

        return orderMapper.findPage(first,pageItemCount,type);
    }


    public List<Order> findAll(){
        return orderMapper.findAll();
    }

    public List<Order> findPageByTitle( Integer pageIndex,
                                        Integer pageCount,
                                        String type,
                                        String title){
        Integer first = (pageIndex-1)*pageCount;
        return orderMapper.findPageByTitle(first,pageCount,type,title);
    }


    public int findTypeCount(String type){
        return orderMapper.findTypeCount(type);
    }
}
